home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / Development / PartMaker / Container•1.0d11v2 / Container•1.0d11v2.rsrc / dFRK_5081 < prev    next >
Encoding:
Text File  |  1995-12-08  |  6.8 KB  |  218 lines

  1. //========================================================================================
  2. //
  3. //    File:                ContainerLink.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef CONTAINERLINK_H
  13. #define CONTAINERLINK_H
  14.  
  15. // ----- Part Layer -----
  16.  
  17. #ifndef FWLINK_H
  18. #include "FWLink.h"
  19. #endif
  20.  
  21. #ifndef FWLNKMGR_H
  22. #include "FWLnkMgr.h"
  23. #endif
  24.  
  25. #ifndef FWPOINT_H
  26. #include "FWPoint.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. #if FW_LIB_EXPORT_PRAGMAS
  34. #pragma import on
  35. #endif
  36. class FW_CLASS_ATTR FW_CPrivOrderedCollection;
  37. class FW_CLASS_ATTR FW_CFrame;
  38. class FW_CLASS_ATTR FW_CCloneInfo;
  39. #if FW_LIB_EXPORT_PRAGMAS
  40. #pragma import off
  41. #endif
  42.  
  43. extern const ODPropertyName kContainerPropSourceLink;
  44. extern const ODPropertyName kContainerPropDestLink;
  45. extern const ODValueType kContainerLinkValue;
  46.  
  47.  
  48. class FW_CLASS_ATTR CBaseShape;
  49. class FW_CLASS_ATTR CContainerSelection;
  50. class FW_CLASS_ATTR CContainerPart;
  51.  
  52. //========================================================================================
  53. //    class CContainerPublishLink
  54. //========================================================================================
  55.  
  56. class FW_CLASS_ATTR CContainerPublishLink : public FW_CPublishLink
  57. {
  58.   public:
  59.     FW_DECLARE_CLASS
  60.  
  61.     CContainerPublishLink(Environment* ev, ODUpdateID updateID, 
  62.                      FW_CPresentation* presentation,
  63.                      CContainerSelection* containerSelection,
  64.                      FW_Boolean saveSelection);
  65.     virtual ~ CContainerPublishLink();
  66.     
  67.     virtual void        Publish(Environment* ev);
  68.     virtual void        ExternalizeLinkContent(Environment* ev, ODStorageUnit* linkSU);
  69.     virtual ODValueType    GetPublishFormat(Environment* ev);
  70.     
  71.     FW_Boolean            HasEmbeddedFrame(Environment *ev, ODFrame* odFrame);
  72.  
  73. //--- Will move to FW_CPublishLink
  74.     virtual FW_CFrame*    GetFrameToRevealLink(Environment* ev);
  75.     virtual void        DoSelect(Environment* ev, FW_CFrame* frame);
  76.  
  77.     void                SelectShapes(Environment* ev);
  78.  
  79.     //--- Persistency
  80.     void                Externalize(Environment* ev, ODStorageUnit* storageUnit,
  81.                                     FW_CCloneInfo* cloneInfo);
  82.     void                AddShape(Environment* ev, CBaseShape* shape);
  83.  
  84.   private:
  85.     void RestoreContainerSelection(Environment* ev);
  86.  
  87.   private:
  88.     CContainerSelection*                    fContainerSelection;
  89.     FW_CPrivOrderedCollection*        fCollection;
  90.     FW_CPrivOrderedCollection*        fSavedSelection;
  91. };
  92.  
  93. //========================================================================================
  94. //    class CContainerSubscribeLink
  95. //========================================================================================
  96.  
  97. class FW_CLASS_ATTR CContainerSubscribeLink : public FW_CSubscribeLink
  98. {
  99.     friend class CContainerLinkManager;
  100.  
  101.   public:
  102.     FW_DECLARE_CLASS
  103.  
  104.     CContainerSubscribeLink(Environment* ev, ODLink* odLink,
  105.                         FW_CPresentation* presentation, 
  106.                         CContainerSelection* containerSelection,
  107.                         ODLinkInfo* linkInfo);
  108.     virtual ~ CContainerSubscribeLink();
  109.  
  110.     //--- Overrides ---
  111.     virtual void    Subscribe(Environment* ev);
  112.     virtual void    DoUpdateLink(Environment* ev, ODStorageUnit* linkContentSU);
  113.     virtual void    BreakLink(Environment* ev);
  114.  
  115.   private:
  116.     void SaveAndSelectShapes(Environment* ev);
  117.     void RestoreContainerSelection(Environment* ev);
  118.     void SetCollection(Environment* ev);
  119.     void EmptyCollection(Environment* ev);
  120.     
  121.     //--- Persistency
  122.     void Externalize(Environment* ev, ODStorageUnit* storageUnit,
  123.                      FW_CCloneInfo* cloneInfo);
  124.     void AddShape(Environment* ev, CBaseShape* shape);
  125.     
  126.   public:
  127.     void SelectShapes(Environment* ev);
  128.     void SetUpdateOffset(Environment* ev, const FW_CPoint& offset);
  129.     
  130.   private:
  131.     CContainerSelection*                    fContainerSelection;
  132.     FW_CPrivOrderedCollection*        fCollection;
  133.     FW_CPrivOrderedCollection*        fSavedSelection;
  134.     FW_CPoint                        fUpdateOffset;
  135. };
  136.  
  137. //----------------------------------------------------------------------------------------
  138. inline void CContainerSubscribeLink::SetUpdateOffset(Environment* ev, const FW_CPoint& offset)
  139. {
  140.     fUpdateOffset = offset;
  141. }
  142.  
  143. //========================================================================================
  144. //    class CContainerLinkManager
  145. //========================================================================================
  146.  
  147. class FW_CLASS_ATTR CContainerLinkManager : public FW_CLinkManager
  148. {
  149.   public:
  150.     FW_DECLARE_CLASS
  151.  
  152. //----------------------------------------------------------------------------------------
  153. //    Constructors/Destructors
  154. //
  155.   public:
  156.     CContainerLinkManager(Environment* ev, CContainerPart* thePart);
  157.     virtual ~CContainerLinkManager();
  158.  
  159. //----------------------------------------------------------------------------------------
  160. //    Override Methods
  161. //
  162.   public:
  163.     virtual FW_CPublishLink*     NewPublishLink(Environment* ev, 
  164.                                                ODUpdateID updateID, 
  165.                                                FW_CPresentation* presentation);
  166.     virtual FW_CSubscribeLink*    NewSubscribeLink(Environment* ev, 
  167.                                                  ODLink* odLink,
  168.                                                  ODLinkInfo* linkInfo,
  169.                                                  FW_CPresentation* presentation);
  170.  
  171.     virtual ODLinkSource*    CreateLink(Environment *ev, ODByteArray* data);
  172.  
  173.     virtual void            DoChangeLinkStatus(Environment* ev, ODFrame* odFrame);
  174.                                 // formerly named LinkStatusChanged
  175.  
  176.     virtual void            DoUpdateLinks(Environment* ev,
  177.                                           ODFrame* odEmbeddedFrame,
  178.                                           ODUpdateID updateID);
  179.                                 // formerly named EmbeddedFrameUpdated
  180.  
  181.     virtual void            RevealLink(Environment* ev, ODLinkSource* linkSource);
  182.  
  183. //----------------------------------------------------------------------------------------
  184. //    Support for Undo/Redoing PasteAs
  185. //
  186.   public:
  187.     virtual void UndoPasteAs(Environment* ev, CContainerSubscribeLink* link);
  188.     virtual void RedoPasteAs(Environment* ev, CContainerSubscribeLink* link);
  189.     virtual void CommitUndone(Environment* ev, CContainerSubscribeLink* link);
  190.  
  191.     CContainerSubscribeLink* GetLatestSubscriber(Environment* ev);
  192.  
  193.     void SelectSubscribedShapes(Environment* ev, CContainerSubscribeLink* link);
  194.     void DeleteSubscribedShapes(Environment* ev, CContainerSubscribeLink* link);
  195.  
  196. //----------------------------------------------------------------------------------------
  197. //    Support for Persistent Links
  198. //
  199.   public:
  200.     void ExternalizeLinks(Environment* ev, ODStorageUnit* su, FW_CCloneInfo* cloneInfo);
  201.     void InternalizeLinks(Environment* ev, ODStorageUnit* storageUnit);
  202.  
  203.     void RegisterSubscribers(Environment* ev);
  204.  
  205.   private:
  206.     void InternalizeOneDestLink(Environment* ev, ODStorageUnit* storageUnit);
  207.     void InternalizeOneSourceLink(Environment* ev, ODStorageUnit* storageUnit);
  208.  
  209.     ODULong GetSUValue(Environment* ev, ODStorageUnit* su, unsigned long size, void *buffer);
  210.  
  211. //----------------------------------------------------------------------------------------
  212. //    Data Members
  213. //
  214.   private:
  215.     CContainerPart*        fContainerPart;
  216. };
  217.  
  218. #endif